package com.st.encriytion;

import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


/**
 * 1、导入依赖
 *   <dependency>
 *  <groupId>com.github.ulisesbocchio</groupId>
 *  <artifactId>jasypt-spring-boot-starter</artifactId>
 *  <version>3.0.4</version>
 *  </dependency>
 *
 *  2、java -cp  jasypt-1.9.2.jar  org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="123456" password=sad124f1f1rf1fgt5 algorithm=PBEWithMD5AndDES
 *  java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="root" password=security algorithm=PBEWithMD5AndDES
 *  input ：明文密码
 *  password：要加的盐（可自己设置）
 *  algorithm：加密算法，这里使用 PBEWithMD5AndDES
 *  结果如下，OUTPUT就是加密之后的密文（密码）
 *
 *  3、在application.yml文件中配置
 * spring:
 *   datasource:
 *     driver-class-name: com.mysql.jdbc.Driver
 *     username: ENC(HPPHfpHVXzNf00SQLBrjug==)
 *     password: ENC(F8ckXFGTF6Wu8dQ51hoNBw==)
 *     url: jdbc:mysql://localhost:3306/foodie-shop-dev?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
 * jasypt:
 *   encryptor:
 *     password: sad124f1f1rf1fgt5
 *4、主启动配置数据库加密注解
 * @EnableEncryptableProperties
 *
 */
@EnableEncryptableProperties
@SpringBootApplication
public class EncryptionDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(EncryptionDemoApplication.class, args);
    }

}
